<script setup lang="ts">
</script>

<template>
     <div class="w-80 relative">
        <div class="loader">
            <div class="dot"></div>
            <div class="dot"></div>
            <div class="dot"></div>
            <div class="dot"></div>
            <div class="dot"></div>
            <div class="dot"></div>
            <div class="dot"></div>
            <div class="dot"></div>
        </div>
    </div>
</template>

<style scoped lang="scss">
@use "sass:math";

.loader {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 50px auto;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dot {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #3498db;
    border-radius: 50%;
    animation: pulse 0.8s infinite ease-in-out;
}

@for $i from 1 through 8 {
  .dot:nth-child(#{$i}) {
    transform: rotate(#{math.div(360, 8) * $i}deg) translate(50px) rotate(-#{math.div(360, 8) * $i}deg);
  }
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(0.5) rotate(inherits);
        opacity: 1;
    }

    50% {
        transform: scale(1) rotate(inherits);
        opacity: 0.3;
        background-color: pink;
    }
}

@for $i from 1 through 8 {
  .dot:nth-child(#{$i}) {
    animation-delay: #{math.div(1,10) * $i}s;
  }
}
</style>
